import { apiClient } from './base'

export const costApi = {
  // 基础CRUD
  getCosts: (params) => apiClient.get('/fycb', { params }),
  createCost: (data) => apiClient.post('/fycb', data),
  getCostById: (id) => apiClient.get(`/fycb/${id}`),
  updateCost: (id, data) => apiClient.put(`/fycb/${id}`, data),
  deleteCost: (id) => apiClient.delete(`/fycb/${id}`),

  // 搜索
  searchCostsByCbms: (cbms) => apiClient.get(`/fycb/search/cbms?cbms=${cbms}`),
  searchCostsByBb: (bb) => apiClient.get(`/fycb/search/bb?bb=${bb}`),
  searchCostsByZt: (zt) => apiClient.get(`/fycb/search/zt?zt=${zt}`),
  searchCostsByDate: (startDate, endDate) => apiClient.get(`/fycb/search/date?startDate=${startDate}&endDate=${endDate}`),
  searchCostsByCost: (minZcb, maxZcb) => apiClient.get(`/fycb/search/cost?minZcb=${minZcb}&maxZcb=${maxZcb}`),
  getAllCosts: () => apiClient.get('/fycb/all'),

  // 统计
  countCostsByZt: (zt) => apiClient.get(`/fycb/count/zt?zt=${zt}`),
  countCostsByBb: (bb) => apiClient.get(`/fycb/count/bb?bb=${bb}`),

  // 测试
  testCostApi: () => apiClient.get('/fycb/test')
} 